<template>
  <div>
    <el-card class="box-card">
      <el-row :gutter="20">
        <el-col :span="5" style="margin-top: 4px">
          我的关注:
          <el-cascader v-model="value" :options="options" size="mini" @change="cascaderChange"></el-cascader>
        </el-col>
      </el-row>
      <el-table ref="zongHeTable" @sort-change="tableGetSortChange" :data="parameterList" height="500px" style="margin: 10px 0 10px" @select="parameterSelect" border>
        <el-table-column label-class-name="DisabledSelection" type="selection" fixed="left" width="40"> </el-table-column>
        <el-table-column align="center" label="编号" prop="parameterId" width="80px"></el-table-column>
        <el-table-column align="center" label="牌号" prop="grade" width="120px" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="国别" prop="country" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="生产商" prop="manufacturer" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="执行标准" prop="standard" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="数据类型" prop="dataType" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="样品规格" width="90px" prop="specification" show-overflow-tooltip></el-table-column>
        <el-table-column sortable="custom" align="center" label="入库时间" width="120px" prop="inDate" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="样品柜编号" width="100px" prop="cabinetNumber" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="项目组" prop="projuctGroup" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="样品提供人" width="100px" prop="sampleProducer" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="数据来源" width="150px" prop="dataSource" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-button type="text" size="mini" @click.native.stop="downloadAttachment(scope.row)">{{ scope.row.dataSource }}</el-button>
          </template>
        </el-table-column>
        <el-table-column align="center" label="备注" prop="remarks" show-overflow-tooltip></el-table-column>
      </el-table>
      <!-- 分页区 -->
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="queryInfo.pageNum" :page-sizes="[10, 20]" :page-size="queryInfo.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"> </el-pagination>
    </el-card>

    <el-tabs style="margin-top: 10px" tab-position="top">
      <!-- <el-tab-pane label="测量统计">
        <measureStatistics ref="measureStatistics" :conditionNum="conditionNum" :importDataType="importDataType"></measureStatistics>
      </el-tab-pane> -->
      <el-tab-pane label="测量条件">
        <!-- 测量条件卡片视图区域 -->
        <measureSelect ref="measureSelect" :conditionNum="conditionNum" :importDataType="importDataType" :tableRow="tableRow" :transConditionInfo="conditionInfo" @echartsLegend="addChart"></measureSelect>
        <!-- 图表展示卡片视图区域 -->
        <el-card class="box-card" style="margin-top: 10px">
          <div slot="header">
            <span style="color:#4e9efd;font-size:17px;">图表展示</span>
          </div>
          <el-row :gutter="20">
            <el-col :span="3">
              <el-button size="mini" style="width:160px; margin-right: 20px" type="primary" v-model="dataZoomType" @click="changeDataZoom(dataZoomType)">切换缩放模式:{{dataZoomType == 'slider' ? '鼠标滚动' : '滑动条'}}</el-button>
            </el-col>
            <el-col :span="2" v-if="conditionInfo.curveTypes == '磁化曲线' || conditionInfo.curveTypes == '铁损曲线'">
              <el-button :type="indexEnlargeXtype" @click="indexEnlargeX" style="width:100px;" size="mini">{{ indexEnlargeXName(indexEnlargeXStatus) }}</el-button>
            </el-col>
            <el-col :span="2" v-if="conditionInfo.curveTypes == '磁化曲线' || conditionInfo.curveTypes == '铁损曲线'">
              <el-button :type="indexEnlargeType" @click="indexEnlarge" style="width:100px" size="mini">{{ indexEnlargeName(indexEnlargeStatus) }}</el-button>
            </el-col>
          </el-row>
          <div id="main" :style="`height:${graphHeight}px;width:${graphWidth}px`"></div>
        </el-card>

        <!-- 测量数据卡片区 -->
        <el-card class="box-card" style="margin-top: 10px">
          <div slot="header">
            <span style="color:#4e9efd;font-size:17px;">测量数据</span>
          </div>
          <el-row :gutter="20">
            <el-col :span="2">
              <el-button size="mini" type="primary" style="width:100px" @click="exportMeasureData">txt文件导出</el-button>
            </el-col>
            <el-col :span="2" v-if="conditionInfo.curveTypes == '磁化曲线'">
              <el-button size="mini" type="primary" style="width:140px" @click="exportTabDataVisible = true">有限元软件数据导出</el-button>
            </el-col>
          </el-row>
          <!-- 动态生成表头 -->
          <el-table height="300px" style="margin-top: 10px; width: 50%" border :data="measureList">
            <template v-for="(item, index) in measureHead">
              <el-table-column :prop="item.name" :label="item.label" :key="index" v-if="item.name != 'id'" align="center"></el-table-column>
            </template>
          </el-table>
        </el-card>
      </el-tab-pane>
      <el-tab-pane label="详细信息">
        <!-- 测量数据卡片视图区域 -->
        <measureDetailed ref="measureDetailed"></measureDetailed>
      </el-tab-pane>
    </el-tabs>
    <el-dialog title="提示" :visible.sync="exportTabDataVisible" width="50%">
      <span>请选择数据格式</span>
      <div slot="footer" class="dialog-footer">
        <!-- <el-button @click="dialogVisible = false">取 消</el-button> -->
        <!-- <el-button type="primary" @click="dialogVisible = false">确 定</el-button> -->
        <el-button type="primary" @click="exportTabData('tab')">Ansys数据导出(.tab)</el-button>
        <el-button type="primary" @click="exportTabData('xlsx')">Comsol数据导出(.xlsx)</el-button>
        <el-button type="primary" @click="exportTabData('txt')">Flux数据导出(.txt)</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import * as echarts from 'echarts'
import { Message } from 'element-ui'
import measureStatistics from './components/measureStatistics.vue'
import measureSelect from './components/measureSelect.vue'
import measureDetailed from './components/measureDetailed.vue'
export default {
  components: {
    measureStatistics,
    measureSelect,
    measureDetailed
  },
  data() {
    return {
      commentId: '', //评论ID
      DataTypeGj: '全部性能', //传入子组件进行判断
      parameterList: [],
      /***************级联选择框******** */
      value: [],
      queryArray: [
        {
          condition: '等于',
          content: '',
          name: ''
        }
      ],
      options: [
        {
          value: 'grade',
          label: '牌号',
          children: []
        },
        {
          value: 'specification',
          label: '样品规格',
          children: []
        },
        {
          value: 'country',
          label: '国别',
          children: []
        },
        {
          value: 'manufacturer',
          label: '生产商',
          children: []
        },
        {
          value: 'standard',
          label: '执行标准',
          children: []
        }
      ],
      exportTabDataVisible: false,
      /***************级联选择框******** */
      dataZoomType: 'slider',
      indexEnlargeStatus: true,
      indexEnlargeXStatus: true,
      indexEnlargeType: '',
      indexEnlargeXtype: '',
      importDataType: '',
      tableRow: {},
      exportMeasureDataId: '',
      xAxisName: '',
      yAxisName: '',
      yAxisAnotherName: '',
      graphWidth: 1350,
      graphHeight: 600,
      GraphOption: {
        sampleSize: '',
        toolbox: {
          show: true,
          feature: {
            dataView: { readOnly: false },
            restore: {},
            saveAsImage: {}
          }
        },
        dataZoom: [
          {
            disabled: false,
            id: 'dataZoomX',
            type: 'slider',
            // top: 'bottom',
            xAxisIndex: [0],
            filterMode: 'empty'
          },
          {
            disabled: false,
            id: 'dataZoomY',
            type: 'slider',
            yAxisIndex: [0],
            filterMode: 'empty'
          }
        ],
        grid: [{ top: 40 , bottom :100 }], //大概每个legend增加20
        legend: {
          icon: 'none',
          textStyle: {
            color: 'inherit'
          },
          // left: '15%',
          // right: '15%',
          data: [],
          formatter: function(name) {
            return echarts.format.truncateText(name, 1000, '14px Microsoft Yahei', '…')
          },
          tooltip: {
            confine: true,
            show: true,
            formatter: (params, ticket, callback) => {
              let paramsSplit = params.name.split(',')
              let paramsBack = paramsSplit
                .map(x => {
                  return x + `<br />`
                })
                .join('') //这里使用join('')是为了祛除map遍历添加的逗号
              return paramsBack
            }
          }
        },
        tooltip: {
          confine: true,
          formatter: (params, ticket, callback) => {
            if (params.componentIndex % 2 == 0) {
              //偶数-■-
              return this.xAxisName + ':' + params.data[0] + `<br />` + this.yAxisName + ':' + params.data[1]
            } else {
              //奇数-○-
              return this.xAxisName + ':' + params.data[0] + `<br />` + this.yAxisAnotherName + ':' + params.data[1]
            }
          }
        },
        xAxis: {
          name: '',
          // max: 'dataMax',
          nameTextStyle: {
            color: 'skyblue',
            padding: [5, 0, 0, 0]
          },
          nameLocation: 'middle',
          axisLine: {
            onZero: false
          }
        },
        yAxis: [
          {
            name: '',
            position: 'left',
            nameTextStyle: {
              color: 'green'
            },
            axisLine: {
              onZero: false
            }
          },
          {
            name: '',
            show: false,
            position: 'right',
            nameTextStyle: {
              color: 'green'
            },
            axisLine: {
              onZero: false
            }
          }
        ],
        series: []
      },
      measureHead: [], //动态生成表头
      measureList: [],
      conditionNum: {},
      total: 10,
      queryInfo: {
        pageNum: 1,
        pageSize: 10,
        userId: JSON.parse(localStorage.getItem('pro__Login_Userinfo')).value.id
      },
      primaryTableSort: {
        content: 'parameterId',
        sortOrder: 'ASC'
      },
      conditionInfo: {
        curveTypes: '',
        timeTypes: '',
        productId: ''
      },
      fastSearchData: {
        content: ''
      },
      primaryTableSort: {
        content: 'parameterId',
        sortOrder: 'ASC'
      },
      sort: '/null'
    }
  },
  created() {
    this.loadData()
  },

  computed: {
    indexEnlargeName() {
      return function(status) {
        if (status == true) {
          this.indexEnlargeType = 'primary'
          // &emsp;等于\u2003   代表一个中文文字大小的空格
          return 'semilogy'
        } else {
          this.indexEnlargeType = 'dashed'
          return '关闭semilogy'
        }
      }
    },
    indexEnlargeXName() {
      return function(status) {
        if (status == true) {
          this.indexEnlargeXtype = 'primary'
          // &emsp;等于\u2003   代表一个中文文字大小的空格
          return 'semilogx'
        } else {
          this.indexEnlargeXtype = 'dashed'
          return '关闭semilogx'
        }
      }
    }
  },
  methods: {
    tableGetSortChange(column) {
      if (column.order == 'ascending') {
        this.primaryTableSort.content = column.prop
        this.primaryTableSort.sortOrder = 'ASC'
      } else if (column.order == 'descending') {
        this.primaryTableSort.content = column.prop
        this.primaryTableSort.sortOrder = 'DASC'
      } else if (column.order == null) {
        this.primaryTableSort.content = 'parameterId'
        this.primaryTableSort.sortOrder = 'ASC'
      }
      this.advancedSearch()
    },
    downloadAttachment(row) {
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: '/attachmentUpload/downLoadAttachmentFile',
        method: 'GET',
        params: {
          filename: row.dataSource
        },
        responseType: 'blob' // 表明返回服务器返回的数据类型
      }).then(res => {
        let blob = new Blob([res.data])
        let fileName = row.dataSource
        if (window.navigator.msSaveOrOpenBlob) {
          navigator.msSaveBlob(blob, fileName)
        } else {
          var link = document.createElement('a')
          link.href = window.URL.createObjectURL(blob)
          link.download = fileName
          link.click()
          //释放内存
          window.URL.revokeObjectURL(link.href)
        }
      })
    },
    /***************级联选择框******** */
    cascaderChange(e) {
      this.queryInfo.pageNum = 1
      this.queryInfo.pageSize = 10
      this.queryArray[0].name = e[0]
      this.queryArray[0].content = e[1]
      this.advancedSearch()
    },
    advancedSearch() {
      var obj = {
        superPageVo: {
          pageNum: this.queryInfo.pageNum,
          pageSize: this.queryInfo.pageSize,
          userId: JSON.parse(localStorage.getItem('pro__Login_Userinfo')).value.id
        },
        advancedVo: {
          pageNum: this.queryInfo.pageNum,
          pageSize: this.queryInfo.pageSize,
          queryArray: this.queryArray,
          type: '',
          andOr: 'and',
          userId: JSON.parse(localStorage.getItem('pro__Login_Userinfo')).value.id
        },
        searchPageVo: {
          pageNum: this.queryInfo.pageNum,
          pageSize: this.queryInfo.pageSize,
          content: this.fastSearchData.content,
          userId: JSON.parse(localStorage.getItem('pro__Login_Userinfo')).value.id
        },
        num: 2,
        content: this.primaryTableSort.content,
        sortOrder: this.primaryTableSort.sortOrder
      }
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: `/productParameter/selectParameter${this.sort}`,
        method: 'POST',
        data: obj
      }).then(res => {
        if (res.data.code == 0) {
          this.total = res.data.result.total
          this.parameterList = res.data.result.records
        }
      })
    },
    handleSizeChange(newSize) {
      this.queryInfo.pageSize = newSize
      this.advancedSearch()
    },
    handleCurrentChange(newPage) {
      this.queryInfo.pageNum = newPage
      this.advancedSearch()
    },

    loadData() {
      console.log('this.curve', this.curve)
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: `/attentionTable/getMyAttention?userId=${JSON.parse(localStorage.getItem('pro__Login_Userinfo')).value.id}`,
        method: 'POST'
      }).then(res => {
        console.log('我的关注', res)
        for (let i = 0; i < res.data.result.country.length; i++) {
          let countryParams = {
            value: res.data.result.country[i],
            label: res.data.result.country[i]
          }
          this.options[2].children.push(countryParams)
        }
        for (let i = 0; i < res.data.result.grade.length; i++) {
          let gradeParams = {
            value: res.data.result.grade[i],
            label: res.data.result.grade[i]
          }
          this.options[0].children.push(gradeParams)
        }
        for (let i = 0; i < res.data.result.manufacturer.length; i++) {
          let manufacturerParams = {
            value: res.data.result.manufacturer[i],
            label: res.data.result.manufacturer[i]
          }
          this.options[3].children.push(manufacturerParams)
        }
        for (let i = 0; i < res.data.result.specification.length; i++) {
          let specificationParams = {
            value: res.data.result.specification[i],
            label: res.data.result.specification[i]
          }
          this.options[1].children.push(specificationParams)
        }
        for (let i = 0; i < res.data.result.standard.length; i++) {
          let standardParams = {
            value: res.data.result.standard[i],
            label: res.data.result.standard[i]
          }
          this.options[4].children.push(standardParams)
        }
      })
    },
    /***************级联选择框******** */

    // echarts横坐标指数倍放大
    indexEnlarge() {
      if (this.indexEnlargeStatus == true) {
        //开启半对数图
        // this.$set(this.GraphOption.xAxis, 'type', 'log')
        // this.$set(this.GraphOption.xAxis, 'logBase', 10)
        // this.$set(this.GraphOption.xAxis, 'minorTick', {
        //   show: true
        // })
        // this.$set(this.GraphOption.xAxis, 'minorSplitLine', {
        //   show: true
        // })
        this.$set(this.GraphOption.yAxis[0], 'type', 'log')
        this.$set(this.GraphOption.yAxis[0], 'logBase', 10)
        this.$set(this.GraphOption.yAxis[0], 'minorTick', {
          show: true
        })
        this.$set(this.GraphOption.yAxis[0], 'minorSplitLine', {
          show: true
        })
        this.indexEnlargeStatus = !this.indexEnlargeStatus
        this.dynamicSetGridAndHeight(this.GraphOption.series)
      } else if (this.indexEnlargeStatus == false) {
        //关闭半对数图
        // this.$delete(this.GraphOption.xAxis, 'type')
        // this.$delete(this.GraphOption.xAxis, 'logBase')
        // this.$delete(this.GraphOption.xAxis, 'minorTick')
        // this.$delete(this.GraphOption.xAxis, 'minorSplitLine')
        this.$delete(this.GraphOption.yAxis[0], 'type')
        this.$delete(this.GraphOption.yAxis[0], 'logBase')
        this.$delete(this.GraphOption.yAxis[0], 'minorTick')
        this.$delete(this.GraphOption.yAxis[0], 'minorSplitLine')
        this.indexEnlargeStatus = !this.indexEnlargeStatus
        this.dynamicSetGridAndHeight(this.GraphOption.series)
      }
    },
    indexEnlargeX() {
      // X轴半对数
      if (this.indexEnlargeXStatus == true) {
        this.$set(this.GraphOption.xAxis, 'type', 'log')
        this.$set(this.GraphOption.xAxis, 'logBase', 10)
        this.$set(this.GraphOption.xAxis, 'minorTick', {
          show: true
        })
        this.$set(this.GraphOption.xAxis, 'minorSplitLine', {
          show: true
        })
        this.indexEnlargeXStatus = !this.indexEnlargeXStatus
        this.dynamicSetGridAndHeight(this.GraphOption.series)
      } else if (this.indexEnlargeXStatus == false) {
        this.$delete(this.GraphOption.xAxis, 'type')
        this.$delete(this.GraphOption.xAxis, 'logBase')
        this.$delete(this.GraphOption.xAxis, 'minorTick')
        this.$delete(this.GraphOption.xAxis, 'minorSplitLine')
        this.indexEnlargeXStatus = !this.indexEnlargeXStatus
        this.dynamicSetGridAndHeight(this.GraphOption.series)
      }
    },

    //测量数据导出按钮
    exportMeasureData() {
      var sampleType = ''
      if (this.importDataType == '软磁性能') {
        sampleType = '软磁'
      } else if (this.importDataType == '永磁性能') {
        sampleType = '永磁'
      } else if (this.importDataType == '导电性能') {
        sampleType = '导电'
      }
      this.axios({
        baseURL: 'http://59.172.104.174:30669',
        url: '/ExportData/exportData',
        method: 'POST',
        data: new Object({ id: this.exportMeasureDataId, type: sampleType + '样品基本参数', dataType: sampleType + this.conditionInfo.timeTypes + this.conditionInfo.curveTypes, specification: this.tableRow.specification }),
        responseType: 'blob'
      }).then(res => {
        console.log('导出的res', res)
        const blob = new Blob([res.data])
        const url = window.URL.createObjectURL(blob)
        const link = document.createElement('a')
        link.style.display = 'none'
        link.download = '测量数据.txt'
        link.href = url
        link.click()
      })
    },

    //tab导出按钮
    exportTabData(suffix) {
      var sampleType = ''
      if (this.importDataType == '软磁性能') {
        sampleType = '软磁'
      } else if (this.importDataType == '永磁性能') {
        sampleType = '永磁'
      } else if (this.importDataType == '导电性能') {
        sampleType = '导电'
      }
      if(suffix !== 'xlsx') {
        this.axios({
          baseURL: 'http://59.172.104.174:30669',
          url: '/ExportData/exportDataTab',
          method: 'POST',
          data: new Object({ id: this.exportMeasureDataId, type: sampleType + '样品基本参数', dataType: sampleType + this.conditionInfo.timeTypes + this.conditionInfo.curveTypes, specification: this.tableRow.specification }),
          responseType: 'blob'
        }).then(res => {
          const blob = new Blob([res.data])
          const url = window.URL.createObjectURL(blob)
          const link = document.createElement('a')
          link.style.display = 'none'
          link.download = `${this.tableRow.grade}.${suffix}`
          link.href = url
          link.click()
        })
      } else {
        this.axios({
          baseURL: 'http://59.172.104.174:30669',
          url: '/ExportData/exportDataExcel',
          method: 'POST',
          data: new Object({ id: this.exportMeasureDataId, type: sampleType + '样品基本参数', dataType: sampleType + this.conditionInfo.timeTypes + this.conditionInfo.curveTypes, specification: this.tableRow.specification }),
          responseType: 'blob'
        }).then(res => {
          const blob = new Blob([res.data])
          const url = window.URL.createObjectURL(blob)
          const link = document.createElement('a')
          link.style.display = 'none'
          link.download = `${this.tableRow.grade}.${suffix}`
          link.href = url
          link.click()
        })
      }
    },

    //获取测量数据，渲染echarts
    addChart(arr, rows, nameTitle, exportMeasureDataId, conditionInfo) {
      this.GraphOption.series = []
      this.conditionInfo = conditionInfo
      this.exportMeasureDataId = exportMeasureDataId
      if (arr == '') {
        this.myChart.clear()
      } else if (this.importDataType == '软磁性能') {
        this.myChart = echarts.init(document.getElementById('main'))
        this.myChart.showLoading()
        this.axios({
          baseURL: 'http://59.172.104.174:30669',
          url: `/productMetricalData/getMaterialData/${this.tableRow.specification}`,
          method: 'POST',
          data: new Object({ type: '软磁' + this.conditionInfo.timeTypes + this.conditionInfo.curveTypes, dataId: arr })
        }).then(res => {
          console.log('冬哥的数据', res)
          this.measureHead = []
          // 处理表头数据
          for (let i = 0; i < res.data.result.comments.length; i++) {
            let addData = {
              label: '',
              name: ''
            }
            addData.label = res.data.result.comments[i].label
            addData.name = res.data.result.comments[i].name
            this.measureHead.push(addData)
          }
          // 处理表身数据
          this.measureList = []
          this.measureList = res.data.result.list[res.data.result.list.length - 1]

          //type=1为普通echarts图表，type=2为以频率为横坐标的图表，type=3为以数据个数为横坐标的图表
          if (res.data.result.type == 3) {
            // 处理echarts表x、y1、y2轴名称
            this.GraphOption.xAxis.name = 'Sample Number' //x轴
            this.GraphOption.yAxis[1].show = true
            this.GraphOption.yAxis[0].name = res.data.result.comments[0].label + '  -○-' //y1轴
            this.GraphOption.yAxis[1].name = res.data.result.comments[1].label + '  -■-' //y2轴
            this.xAxisName = 'Sample Number'
            this.yAxisName = res.data.result.comments[0].label
            this.yAxisAnotherName = res.data.result.comments[1].label
            if (this.GraphOption.xAxis.min != undefined) {
              this.$delete(this.GraphOption.xAxis, 'min')
            }
            this.$set(this.GraphOption.xAxis, 'max', 'dataMax')
            this.$set(this.GraphOption.yAxis[0], 'max', 1)
            this.$set(this.GraphOption.yAxis[0], 'min', -1)
            this.$set(this.GraphOption.yAxis[1], 'max', 1)
            this.$set(this.GraphOption.yAxis[1], 'min', -1)

            // 缩放为1处理
            let zoomYOne = res.data.result.maxY
            let zoomYTwo = res.data.result.maxX

            // 处理echarts表series数据
            for (let i = 0; i < res.data.result.list.length; i++) {
              var sonArrayOne = []
              var sonArrayTwo = []
              for (let j = 0; j < res.data.result.list[i].length; j++) {
                var grandsonArrayOne = []
                var grandsonArrayTwo = []
                for (let k in res.data.result.list[i][j]) {
                  if (k == res.data.result.comments[0].name) {
                    grandsonArrayOne[0] = j
                    grandsonArrayOne[1] = res.data.result.list[i][j][k] / zoomYOne
                  } else if (k == res.data.result.comments[1].name) {
                    grandsonArrayTwo[0] = j
                    grandsonArrayTwo[1] = res.data.result.list[i][j][k] / zoomYTwo
                  }
                }
                sonArrayOne[j] = grandsonArrayOne
                sonArrayTwo[j] = grandsonArrayTwo
              }
              let inputParamsOne = {
                name: nameTitle[i],
                data: sonArrayOne,
                type: 'line',
                smooth: false
              }
              let inputParamsTwo = {
                name: nameTitle[i],
                data: sonArrayTwo,
                type: 'line',
                smooth: false,
                symbol: 'rect'
                // colorBy: 'series',
                // itemStyle: {
                //   color: this.randColor(),
                // },
              }
              this.GraphOption.series.push(inputParamsOne)
              this.GraphOption.series.push(inputParamsTwo)
            }

            // 处理echarts表legend数据
            this.GraphOption.legend.data = nameTitle
          } else if (res.data.result.type == 2) {
            // 处理echarts表x、y1、y2轴名称
            this.GraphOption.xAxis.name = 'time/s' //x轴
            this.GraphOption.yAxis[1].show = true
            this.GraphOption.yAxis[0].name = res.data.result.comments[0].label + '  -○-' //y1轴
            this.GraphOption.yAxis[1].name = res.data.result.comments[1].label + '  -■-' //y2轴
            this.xAxisName = 'time/s'
            this.yAxisName = res.data.result.comments[0].label
            this.yAxisAnotherName = res.data.result.comments[1].label
            if (this.GraphOption.xAxis.min != undefined) {
              this.$delete(this.GraphOption.xAxis, 'min')
            }
            this.$set(this.GraphOption.xAxis, 'max', 'dataMax')
            this.$set(this.GraphOption.yAxis[0], 'max', 1)
            this.$set(this.GraphOption.yAxis[0], 'min', -1)
            this.$set(this.GraphOption.yAxis[1], 'max', 1)
            this.$set(this.GraphOption.yAxis[1], 'min', -1)

            // 缩放为1处理
            let timeOptions = []
            for (let i = 0; i < rows.length; i++) {
              timeOptions[i] = 1 / rows[i].frequency
            }
            let zoomYOne = res.data.result.maxY
            let zoomYTwo = res.data.result.maxX

            // 处理echarts表series数据
            for (let i = 0; i < res.data.result.list.length; i++) {
              var sonArrayOne = []
              var sonArrayTwo = []
              let jSub = timeOptions[i] / res.data.result.list[i].length
              for (let j = 0, m = 0; j < timeOptions[i]; m++) {
                var grandsonArrayOne = []
                var grandsonArrayTwo = []
                for (let k in res.data.result.list[i][m]) {
                  if (k == res.data.result.comments[0].name) {
                    if (m == res.data.result.list[i].length - 1) {
                      // 定死x轴坐标最大值
                      grandsonArrayOne[0] = timeOptions[i]
                    } else {
                      grandsonArrayOne[0] = j
                    }
                    grandsonArrayOne[1] = res.data.result.list[i][m][k] / zoomYOne
                  } else if (k == res.data.result.comments[1].name) {
                    if (m == res.data.result.list[i].length - 1) {
                      // 定死x轴坐标最大值
                      grandsonArrayTwo[0] = timeOptions[i]
                    } else {
                      grandsonArrayTwo[0] = j
                    }
                    grandsonArrayTwo[1] = res.data.result.list[i][m][k] / zoomYTwo
                  }
                }
                sonArrayOne[m] = grandsonArrayOne
                sonArrayTwo[m] = grandsonArrayTwo

                j = j + jSub
              }
              let inputParamsOne = {
                name: nameTitle[i],
                data: sonArrayOne,
                type: 'line',
                smooth: false
              }
              let inputParamsTwo = {
                name: nameTitle[i],
                data: sonArrayTwo,
                type: 'line',
                smooth: false,
                symbol: 'rect'
                // colorBy: 'series',
                // itemStyle: {
                //   color: this.randColor(),
                // },
              }
              this.GraphOption.series.push(inputParamsOne)
              this.GraphOption.series.push(inputParamsTwo)
            }
            // 处理echarts表legend数据
            this.GraphOption.legend.data = nameTitle
          } else if (res.data.result.type == 1) {
            // 处理echarts表x、y轴名称
            this.GraphOption.xAxis.name = res.data.result.comments[0].label //x轴
            this.GraphOption.yAxis[1].show = false
            this.GraphOption.yAxis[0].name = res.data.result.comments[1].label //y轴
            this.xAxisName = res.data.result.comments[0].label
            this.yAxisName = res.data.result.comments[1].label
            this.yAxisAnotherName = res.data.result.comments[1].label
            if (this.GraphOption.yAxis[0].max != undefined) {
              this.$delete(this.GraphOption.xAxis, 'max')
              this.$delete(this.GraphOption.yAxis[0], 'max')
              this.$delete(this.GraphOption.yAxis[0], 'min')
              this.$delete(this.GraphOption.yAxis[1], 'max')
              this.$delete(this.GraphOption.yAxis[1], 'min')
            }

            // 处理echarts表series数据
            for (let i = 0; i < res.data.result.list.length; i++) {
              var sonArray = []
              for (let j = 0; j < res.data.result.list[i].length; j++) {
                var grandsonArray = []
                for (let k in res.data.result.list[i][j]) {
                  if (k == res.data.result.comments[0].name) {
                    grandsonArray[0] = res.data.result.list[i][j][k]
                  } else if (k == res.data.result.comments[1].name) {
                    grandsonArray[1] = res.data.result.list[i][j][k]
                  }
                }
                sonArray[j] = grandsonArray
              }
              let inputParams = {
                name: nameTitle[i],
                data: sonArray,
                type: 'line',
                smooth: false
              }
              this.GraphOption.series.push(inputParams)
            }

            // 处理echarts表legend数据
            this.GraphOption.legend.data = nameTitle
          }

          this.dynamicSetGridAndHeight(rows)
        })
      } else if (this.importDataType == '永磁性能') {
        this.myChart = echarts.init(document.getElementById('main'))
        this.myChart.showLoading()
        this.axios({
          baseURL: 'http://59.172.104.174:30669',
          url: '/perMaterialData/getMaterialData',
          method: 'POST',
          data: new Object({ type: '永磁' + this.conditionInfo.timeTypes + this.conditionInfo.curveTypes, dataId: arr })
        }).then(res => {
          console.log('冬哥的数据', res)
          this.measureHead = []
          // 处理表头数据
          for (let i = 1; i <= res.data.result.comments.length - 2; i++) {
            let addData = {
              label: '',
              name: ''
            }
            addData.label = res.data.result.comments[i].label
            addData.name = res.data.result.comments[i].name
            this.measureHead.push(addData)
          }
          // 处理表身数据
          this.measureList = []
          if (this.conditionInfo.curveTypes !== '磁滞回线') {
            this.measureList = JSON.parse(JSON.stringify(res.data.result.list[res.data.result.list.length - 1]))
          } else {
            this.measureList = JSON.parse(JSON.stringify(res.data.result.listBt[res.data.result.listBt.length - 1]))
            this.measureList.unshift(...JSON.parse(JSON.stringify(res.data.result.listJt[res.data.result.listJt.length - 1])))
          }
          //type=1为普通echarts图表，type=2为以频率为横坐标的图表，type=3为以数据个数为横坐标的图表
          if (res.data.result.type == 3) {
            // 处理echarts表x、y1、y2轴名称
            this.GraphOption.xAxis.name = 'Sample Number' //x轴
            this.GraphOption.yAxis[1].show = true
            this.GraphOption.yAxis[0].name = res.data.result.comments[1].label + '  -○-' //y1轴
            this.GraphOption.yAxis[1].name = res.data.result.comments[2].label + '  -■-' //y2轴
            this.xAxisName = 'Sample Number'
            this.yAxisName = res.data.result.comments[1].label
            this.yAxisAnotherName = res.data.result.comments[2].label
            if (this.GraphOption.xAxis.min != undefined) {
              this.$delete(this.GraphOption.xAxis, 'min')
            }
            this.$set(this.GraphOption.xAxis, 'max', 'dataMax')
            this.$set(this.GraphOption.yAxis[0], 'max', 1)
            this.$set(this.GraphOption.yAxis[0], 'min', -1)
            this.$set(this.GraphOption.yAxis[1], 'max', 1)
            this.$set(this.GraphOption.yAxis[1], 'min', -1)

            // 缩放为1处理
            let zoomYOne = res.data.result.maxY
            let zoomYTwo = res.data.result.maxX

            // 处理echarts表series数据
            for (let i = 0; i < res.data.result.list.length; i++) {
              var sonArrayOne = []
              var sonArrayTwo = []
              for (let j = 0; j < res.data.result.list[i].length; j++) {
                var grandsonArrayOne = []
                var grandsonArrayTwo = []
                for (let k in res.data.result.list[i][j]) {
                  if (k == res.data.result.comments[2].name) {
                    grandsonArrayOne[0] = j
                    grandsonArrayOne[1] = res.data.result.list[i][j][k] / zoomYOne
                  } else if (k == res.data.result.comments[1].name) {
                    grandsonArrayTwo[0] = j
                    grandsonArrayTwo[1] = res.data.result.list[i][j][k] / zoomYTwo
                  }
                }
                sonArrayOne[j] = grandsonArrayOne
                sonArrayTwo[j] = grandsonArrayTwo
              }
              let inputParamsOne = {
                name: nameTitle[i],
                data: sonArrayOne,
                type: 'line',
                smooth: false
              }
              let inputParamsTwo = {
                name: nameTitle[i],
                data: sonArrayTwo,
                type: 'line',
                smooth: false,
                symbol: 'rect'
                // colorBy: 'series',
                // itemStyle: {
                //   color: this.randColor(),
                // },
              }
              this.GraphOption.series.push(inputParamsOne)
              this.GraphOption.series.push(inputParamsTwo)
            }

            // 处理echarts表legend数据
            this.GraphOption.legend.data = nameTitle
          } else if (res.data.result.type == 2) {
            // 处理echarts表x、y1、y2轴名称
            this.GraphOption.xAxis.name = 'time/s' //x轴
            this.GraphOption.yAxis[1].show = true
            this.GraphOption.yAxis[0].name = res.data.result.comments[1].label + '  -○-' //y1轴
            this.GraphOption.yAxis[1].name = res.data.result.comments[2].label + '  -■-' //y2轴
            this.xAxisName = 'time/s'
            this.yAxisName = res.data.result.comments[1].label
            this.yAxisAnotherName = res.data.result.comments[2].label
            if (this.GraphOption.xAxis.min != undefined) {
              this.$delete(this.GraphOption.xAxis, 'min')
            }
            this.$set(this.GraphOption.xAxis, 'max', 'dataMax')
            this.$set(this.GraphOption.yAxis[0], 'max', 1)
            this.$set(this.GraphOption.yAxis[0], 'min', -1)
            this.$set(this.GraphOption.yAxis[1], 'max', 1)
            this.$set(this.GraphOption.yAxis[1], 'min', -1)

            // 缩放为1处理
            let timeOptions = []
            for (let i = 0; i < rows.length; i++) {
              timeOptions[i] = 1 / rows[i].frequency
            }
            let zoomYOne = res.data.result.maxY
            let zoomYTwo = res.data.result.maxX

            // 处理echarts表series数据
            for (let i = 0; i < res.data.result.list.length; i++) {
              var sonArrayOne = []
              var sonArrayTwo = []
              let jSub = timeOptions[i] / res.data.result.list[i].length
              for (let j = 0, m = 0; j < timeOptions[i]; m++) {
                var grandsonArrayOne = []
                var grandsonArrayTwo = []
                for (let k in res.data.result.list[i][m]) {
                  if (k == res.data.result.comments[2].name) {
                    if (m == res.data.result.list[i].length - 1) {
                      // 定死x轴坐标最大值
                      grandsonArrayOne[0] = timeOptions[i]
                    } else {
                      grandsonArrayOne[0] = j
                    }
                    grandsonArrayOne[1] = res.data.result.list[i][m][k] / zoomYOne
                  } else if (k == res.data.result.comments[1].name) {
                    if (m == res.data.result.list[i].length - 1) {
                      // 定死x轴坐标最大值
                      grandsonArrayTwo[0] = timeOptions[i]
                    } else {
                      grandsonArrayTwo[0] = j
                    }
                    grandsonArrayTwo[1] = res.data.result.list[i][m][k] / zoomYTwo
                  }
                }
                sonArrayOne[m] = grandsonArrayOne
                sonArrayTwo[m] = grandsonArrayTwo

                j = j + jSub
              }
              let inputParamsOne = {
                name: nameTitle[i],
                data: sonArrayOne,
                type: 'line',
                smooth: false
              }
              let inputParamsTwo = {
                name: nameTitle[i],
                data: sonArrayTwo,
                type: 'line',
                smooth: false,
                symbol: 'rect'
                // colorBy: 'series',
                // itemStyle: {
                //   color: this.randColor(),
                // },
              }
              this.GraphOption.series.push(inputParamsOne)
              this.GraphOption.series.push(inputParamsTwo)
            }
            // 处理echarts表legend数据
            this.GraphOption.legend.data = nameTitle
          } else if (res.data.result.type == 1 && this.conditionInfo.curveTypes == '磁滞回线') {
            // 海工大要求：磁滞回线与退磁曲线只显示第二象限坐标点
            // 处理echarts表x、y轴名称
            this.GraphOption.xAxis.name = res.data.result.comments[1].label //x轴
            this.GraphOption.yAxis[1].show = true //是否开启双y轴
            this.GraphOption.yAxis[0].name = res.data.result.comments[2].label + '  ⬤' //y1轴
            this.GraphOption.yAxis[1].name = res.data.result.comments[3].label + '  ◆' //y2轴
            this.xAxisName = res.data.result.comments[1].label
            this.yAxisName = res.data.result.comments[2].label
            this.yAxisAnotherName = res.data.result.comments[3].label
            if (this.GraphOption.yAxis[0].max != undefined) {
              this.$delete(this.GraphOption.yAxis[0], 'max')
              this.$delete(this.GraphOption.yAxis[0], 'min')
              this.$delete(this.GraphOption.yAxis[1], 'max')
              this.$delete(this.GraphOption.yAxis[1], 'min')
            }

            // 处理echarts表series数据
            for (let i = 0; i < res.data.result.listBt.length; i++) {
              var sonArrayOne = []
              var sonArrayOneNum = 0
              for (let j = 0; j < res.data.result.listBt[i].length; j++) {
                var xNum = ''
                var yNumOne = ''
                for (let k in res.data.result.listBt[i][j]) {
                  if (k == res.data.result.comments[1].name) {
                    xNum = res.data.result.listBt[i][j][k]
                  } else if (k == res.data.result.comments[2].name) {
                    yNumOne = res.data.result.listBt[i][j][k]
                  }
                }
                sonArrayOne[sonArrayOneNum] = [xNum, yNumOne]
                sonArrayOneNum++
              }

              let inputParamsOne = {
                name: nameTitle[i],
                data: sonArrayOne,
                type: 'scatter',
                smooth: false,
                symbol: 'circle',
                symbolSize: 5
              }
              this.GraphOption.series.push(inputParamsOne)
            }
            for (let i = 0; i < res.data.result.listJt.length; i++) {
              var sonArrayTwo = []
              var sonArrayTwoNum = 0
              for (let j = 0; j < res.data.result.listJt[i].length; j++) {
                var xNum = ''
                var yNumTwo = ''
                for (let k in res.data.result.listJt[i][j]) {
                  if (k == res.data.result.comments[1].name) {
                    xNum = res.data.result.listJt[i][j][k]
                  } else if (k == res.data.result.comments[3].name) {
                    yNumTwo = res.data.result.listJt[i][j][k]
                  }
                }
                sonArrayTwo[sonArrayTwoNum] = [xNum, yNumTwo]
                sonArrayTwoNum++
              }

              let inputParamsTwo = {
                name: nameTitle[i],
                data: sonArrayTwo,
                type: 'scatter',
                smooth: false,
                symbol: 'diamond',
                symbolSize: 5
              }
              // this.GraphOption.series.push(inputParamsOne)
              this.GraphOption.series.push(inputParamsTwo)
            }
            // 处理echarts表legend数据
            this.GraphOption.legend.data = nameTitle
          } else if (res.data.result.type == 1 && this.conditionInfo.curveTypes == '退磁曲线') {
            // 海工大要求：磁滞回线与退磁曲线只显示第二象限坐标点
            // 处理echarts表x、y轴名称
            this.GraphOption.xAxis.name = res.data.result.comments[1].label //x轴
            this.GraphOption.yAxis[1].show = true //是否开启双y轴
            this.GraphOption.yAxis[0].name = res.data.result.comments[2].label + '  -○-' //y1轴
            this.GraphOption.yAxis[1].name = res.data.result.comments[3].label + '  -■-' //y2轴
            this.xAxisName = res.data.result.comments[1].label
            this.yAxisName = res.data.result.comments[2].label
            this.yAxisAnotherName = res.data.result.comments[3].label
            if (this.GraphOption.yAxis[0].max != undefined) {
              this.$delete(this.GraphOption.yAxis[0], 'max')
              this.$delete(this.GraphOption.yAxis[0], 'min')
              this.$delete(this.GraphOption.yAxis[1], 'max')
              this.$delete(this.GraphOption.yAxis[1], 'min')
            }
            this.$set(this.GraphOption.xAxis, 'max', 0)
            this.$set(this.GraphOption.yAxis[0], 'min', 0)
            this.$set(this.GraphOption.yAxis[1], 'min', 0)

            // 处理echarts表series数据
            for (let i = 0; i < res.data.result.list.length; i++) {
              var sonArrayOne = []
              var sonArrayTwo = []
              var sonArrayOneNum = 0
              var sonArrayTwoNum = 0
              for (let j = 0; j < res.data.result.list[i].length; j++) {
                var xNum = ''
                var yNumOne = ''
                var yNumTwo = ''
                for (let k in res.data.result.list[i][j]) {
                  if (k == res.data.result.comments[1].name) {
                    xNum = res.data.result.list[i][j][k]
                  } else if (k == res.data.result.comments[2].name) {
                    yNumOne = res.data.result.list[i][j][k]
                  } else if (k == res.data.result.comments[3].name) {
                    yNumTwo = res.data.result.list[i][j][k]
                  }
                }
                sonArrayOne[sonArrayOneNum] = [xNum, yNumOne]
                sonArrayOneNum++
                sonArrayTwo[sonArrayTwoNum] = [xNum, yNumTwo]
                sonArrayTwoNum++
              }

              let inputParamsOne = {
                name: nameTitle[i],
                data: sonArrayOne,
                type: 'line',
                smooth: false
              }
              let inputParamsTwo = {
                name: nameTitle[i],
                data: sonArrayTwo,
                type: 'line',
                smooth: false,
                symbol: 'rect'
                // colorBy: 'series',
                // itemStyle: {
                //   color: this.randColor(),
                // },
              }
              this.GraphOption.series.push(inputParamsOne)
              this.GraphOption.series.push(inputParamsTwo)
            }

            // 处理echarts表legend数据
            this.GraphOption.legend.data = nameTitle
          }

          this.dynamicSetGridAndHeight(rows)
        })
      } else if (this.importDataType == '导电性能') {
        this.myChart = echarts.init(document.getElementById('main'))
        this.myChart.showLoading()
        this.axios({
          baseURL: 'http://59.172.104.174:30669',
          url: '/eleData/getMaterialData',
          method: 'POST',
          data: new Object({ type: '导电' + this.conditionInfo.timeTypes + this.conditionInfo.curveTypes, dataId: arr })
        }).then(res => {
          this.measureHead = []
          // 处理表头数据
          for (let i = 1; i < res.data.result.comments.length - 1; i++) {
            let addData = {
              label: '',
              name: ''
            }
            addData.label = res.data.result.comments[i].label
            addData.name = res.data.result.comments[i].name
            this.measureHead.push(addData)
          }
          // 处理表身数据
          this.measureList = []
          this.measureList = res.data.result.list[res.data.result.list.length - 1]

          //type=1为普通echarts图表，type=2为以频率为横坐标的图表，type=3为以数据个数为横坐标的图表
          if (res.data.result.type == 3) {
            // 处理echarts表x、y1、y2轴名称
            this.GraphOption.xAxis.name = 'Sample Number' //x轴
            this.GraphOption.yAxis[1].show = true
            this.GraphOption.yAxis[0].name = res.data.result.comments[1].label + '  -○-' //y1轴
            this.GraphOption.yAxis[1].name = res.data.result.comments[2].label + '  -■-' //y2轴
            this.xAxisName = 'Sample Number'
            this.yAxisName = res.data.result.comments[1].label
            this.yAxisAnotherName = res.data.result.comments[2].label
            if (this.GraphOption.xAxis.min != undefined) {
              this.$delete(this.GraphOption.xAxis, 'min')
            }
            this.$set(this.GraphOption.xAxis, 'max', 'dataMax')
            this.$set(this.GraphOption.yAxis[0], 'max', 1)
            this.$set(this.GraphOption.yAxis[0], 'min', -1)
            this.$set(this.GraphOption.yAxis[1], 'max', 1)
            this.$set(this.GraphOption.yAxis[1], 'min', -1)

            // 缩放为1处理
            let zoomYOne = res.data.result.maxY
            let zoomYTwo = res.data.result.maxX

            // 处理echarts表series数据
            for (let i = 0; i < res.data.result.list.length; i++) {
              var sonArrayOne = []
              var sonArrayTwo = []
              for (let j = 0; j < res.data.result.list[i].length; j++) {
                var grandsonArrayOne = []
                var grandsonArrayTwo = []
                for (let k in res.data.result.list[i][j]) {
                  if (k == res.data.result.comments[2].name) {
                    grandsonArrayOne[0] = j
                    grandsonArrayOne[1] = res.data.result.list[i][j][k] / zoomYOne
                  } else if (k == res.data.result.comments[1].name) {
                    grandsonArrayTwo[0] = j
                    grandsonArrayTwo[1] = res.data.result.list[i][j][k] / zoomYTwo
                  }
                }
                sonArrayOne[j] = grandsonArrayOne
                sonArrayTwo[j] = grandsonArrayTwo
              }
              let inputParamsOne = {
                name: nameTitle[i],
                data: sonArrayOne,
                type: 'line',
                smooth: false
              }
              let inputParamsTwo = {
                name: nameTitle[i],
                data: sonArrayTwo,
                type: 'line',
                smooth: false,
                symbol: 'rect'
                // colorBy: 'series',
                // itemStyle: {
                //   color: this.randColor(),
                // },
              }
              this.GraphOption.series.push(inputParamsOne)
              this.GraphOption.series.push(inputParamsTwo)
            }

            // 处理echarts表legend数据
            this.GraphOption.legend.data = nameTitle
          } else if (res.data.result.type == 2) {
            // 处理echarts表x、y1、y2轴名称
            this.GraphOption.xAxis.name = 'time/s' //x轴
            this.GraphOption.yAxis[1].show = true
            this.GraphOption.yAxis[0].name = res.data.result.comments[1].label + '  -○-' //y1轴
            this.GraphOption.yAxis[1].name = res.data.result.comments[2].label + '  -■-' //y2轴
            this.xAxisName = 'time/s'
            this.yAxisName = res.data.result.comments[1].label
            this.yAxisAnotherName = res.data.result.comments[2].label
            if (this.GraphOption.xAxis.min != undefined) {
              this.$delete(this.GraphOption.xAxis, 'min')
            }
            this.$set(this.GraphOption.xAxis, 'max', 'dataMax')
            this.$set(this.GraphOption.yAxis[0], 'max', 1)
            this.$set(this.GraphOption.yAxis[0], 'min', -1)
            this.$set(this.GraphOption.yAxis[1], 'max', 1)
            this.$set(this.GraphOption.yAxis[1], 'min', -1)

            // 缩放为1处理
            let timeOptions = []
            for (let i = 0; i < rows.length; i++) {
              timeOptions[i] = 1 / rows[i].frequency
            }
            let zoomYOne = res.data.result.maxY
            let zoomYTwo = res.data.result.maxX

            // 处理echarts表series数据
            for (let i = 0; i < res.data.result.list.length; i++) {
              var sonArrayOne = []
              var sonArrayTwo = []
              let jSub = timeOptions[i] / res.data.result.list[i].length
              for (let j = 0, m = 0; j < timeOptions[i]; m++) {
                var grandsonArrayOne = []
                var grandsonArrayTwo = []
                for (let k in res.data.result.list[i][m]) {
                  if (k == res.data.result.comments[2].name) {
                    if (m == res.data.result.list[i].length - 1) {
                      // 定死x轴坐标最大值
                      grandsonArrayOne[0] = timeOptions[i]
                    } else {
                      grandsonArrayOne[0] = j
                    }
                    grandsonArrayOne[1] = res.data.result.list[i][m][k] / zoomYOne
                  } else if (k == res.data.result.comments[1].name) {
                    if (m == res.data.result.list[i].length - 1) {
                      // 定死x轴坐标最大值
                      grandsonArrayTwo[0] = timeOptions[i]
                    } else {
                      grandsonArrayTwo[0] = j
                    }
                    grandsonArrayTwo[1] = res.data.result.list[i][m][k] / zoomYTwo
                  }
                }
                sonArrayOne[m] = grandsonArrayOne
                sonArrayTwo[m] = grandsonArrayTwo

                j = j + jSub
              }
              let inputParamsOne = {
                name: nameTitle[i],
                data: sonArrayOne,
                type: 'line',
                smooth: false
              }
              let inputParamsTwo = {
                name: nameTitle[i],
                data: sonArrayTwo,
                type: 'line',
                smooth: false,
                symbol: 'rect'
                // colorBy: 'series',
                // itemStyle: {
                //   color: this.randColor(),
                // },
              }
              this.GraphOption.series.push(inputParamsOne)
              this.GraphOption.series.push(inputParamsTwo)
            }
            // 处理echarts表legend数据
            this.GraphOption.legend.data = nameTitle
          } else if (res.data.result.type == 1) {
            // 处理echarts表x、y轴名称
            this.GraphOption.xAxis.name = res.data.result.comments[1].label //x轴
            this.GraphOption.yAxis[1].show = false
            this.GraphOption.yAxis[0].name = res.data.result.comments[2].label //y轴
            this.xAxisName = res.data.result.comments[2].label
            this.yAxisName = res.data.result.comments[1].label
            this.yAxisAnotherName = res.data.result.comments[1].label
            if (this.GraphOption.yAxis[0].max != undefined) {
              this.$delete(this.GraphOption.xAxis, 'max')
              this.$delete(this.GraphOption.yAxis[0], 'max')
              this.$delete(this.GraphOption.yAxis[0], 'min')
              this.$delete(this.GraphOption.yAxis[1], 'max')
              this.$delete(this.GraphOption.yAxis[1], 'min')
            }
            this.$set(this.GraphOption.xAxis, 'scale', true)
            this.$set(this.GraphOption.yAxis[0], 'scale', true)
            this.$set(this.GraphOption.yAxis[1], 'scale', true)

            // 处理echarts表series数据
            for (let i = 0; i < res.data.result.list.length; i++) {
              var sonArray = []
              for (let j = 0; j < res.data.result.list[i].length; j++) {
                var grandsonArray = []
                for (let k in res.data.result.list[i][j]) {
                  if (k == res.data.result.comments[1].name) {
                    grandsonArray[0] = res.data.result.list[i][j][k]
                  } else if (k == res.data.result.comments[2].name) {
                    grandsonArray[1] = res.data.result.list[i][j][k]
                  }
                }
                sonArray[j] = grandsonArray
              }
              let inputParams = {
                name: nameTitle[i],
                data: sonArray,
                type: 'line',
                smooth: false
              }
              this.GraphOption.series.push(inputParams)
            }

            // 处理echarts表legend数据
            this.GraphOption.legend.data = nameTitle
            console.log('this.GraphOption', this.GraphOption)
          }

          this.dynamicSetGridAndHeight(rows)
        })
      }
    },
    // 随机生成一个rgb颜色
    randColor() {
      let colorw = `rgb(${Math.round(Math.random() * 255)},${Math.round(Math.random() * 255)},${Math.round(Math.random() * 255)})`
      return colorw
    },
    dynamicSetGridAndHeight(rows) {
      let legendNum = rows.length
      if (legendNum == 0) {
        this.GraphOption.grid[0].top = 40
        this.graphHeight = 600
      } else {
        this.GraphOption.grid[0].top = 30 + 20 * legendNum + Math.trunc(legendNum / 10) * 20
        this.graphHeight = 600 + 20 * (legendNum - 1)
      }
      this.$nextTick(() => {
        this.drawChart(this.graphHeight)
      })
    },
    // 切换缩放模式
    changeDataZoom(dataZoomType) {
      console.log("dataZoomType-----------------",dataZoomType);
      if(dataZoomType == 'slider') {
        this.dataZoomType = 'inside'
        this.GraphOption.dataZoom[0].type = 'inside'
        this.GraphOption.dataZoom[1].type = 'inside'
      } else {
        this.dataZoomType = 'slider'
        this.GraphOption.dataZoom[0].type = 'slider'
        this.GraphOption.dataZoom[1].type = 'slider'
      }
      this.myChart.setOption(this.GraphOption)
    },
    drawChart(relHeight) {
      this.myChart.clear()
      this.myChart.hideLoading()
      this.myChart.setOption(this.GraphOption)
      const autoHeight = relHeight
      // myChart.getDom().style.height = autoHeight + 'px'
      this.myChart.resize()
    },

    //勾选一项的事件
    parameterSelect(selection, row) {
      // console.log(selection,row);
      if(selection.length < 1) {
        this.$refs.measureDetailed.unSelected(true)
      } else {
        this.$refs.measureDetailed.unSelected(false)
      }
      if (selection.length > 1) {
        this.$refs.zongHeTable.clearSelection()
        selection.shift()
        this.$refs.zongHeTable.toggleRowSelection(row)
      }
      // // 高亮当前行
      // this.$refs.zongHeTable.setCurrentRow(row)

      this.tableRow = row
      this.importDataType = row.dataType
      if (row.dataType == '软磁性能') {
        this.axios({
          //获取数量
          baseURL: 'http://59.172.104.174:30669',
          url: `/productParameter/selectNum?id=${row.id}`,
          methods: 'GET'
        }).then(res => {
          this.conditionNum = res.data.result
        })
        this.producerDetail = {
          producer: '',
          country: '',
          address: '',
          email: '',
          website: '',
          telephone: '',
          fax: ''
        }
        this.sampleSize = row.specification
        this.conditionInfo.productId = row.id
        this.mark = row.grade
        this.country = row.country
        this.producer = row.manufacturer
        this.selectNum = row.parameterId
        if (this.myChart !== undefined) {
          this.myChart.clear()
        }
        this.$refs.measureSelect.getDataFromUp(this.conditionInfo, this.sampleSize)
        this.$refs.measureDetailed.getDetailMessage(row.dataType, row.specification, this.mark, this.country, this.producer, this.conditionInfo, this.selectNum)
      } else if (row.dataType == '永磁性能') {
        this.axios({
          //获取数量
          baseURL: 'http://59.172.104.174:30669',
          url: `/measurement/selectNum?id=${row.id}`,
          methods: 'GET'
        }).then(res => {
          this.conditionNum = res.data.result
        })
        this.producerDetail = {
          producer: '',
          country: '',
          address: '',
          email: '',
          website: '',
          telephone: '',
          fax: ''
        }
        this.sampleSize = row.specification
        this.conditionInfo.productId = row.id
        this.mark = row.grade
        this.country = row.country
        this.producer = row.manufacturer
        this.selectNum = row.parameterId
        if (this.myChart !== undefined) {
          this.myChart.clear()
        }
        this.$refs.measureSelect.getDataFromUp(this.conditionInfo, this.sampleSize)
        this.$refs.measureDetailed.getDetailMessage(row.dataType, row.specification, this.mark, this.country, this.producer, this.conditionInfo, this.selectNum)
      } else if (row.dataType == '导电性能') {
        this.axios({
          //获取数量
          baseURL: 'http://59.172.104.174:30669',
          url: `/eleMeasurement/selectNum?id=${row.id}`,
          methods: 'GET'
        }).then(res => {
          this.conditionNum = res.data.result
        })
        this.producerDetail = {
          producer: '',
          country: '',
          address: '',
          email: '',
          website: '',
          telephone: '',
          fax: ''
        }
        this.sampleSize = row.specification
        this.conditionInfo.productId = row.id
        this.mark = row.grade
        this.country = row.country
        this.producer = row.manufacturer
        this.selectNum = row.parameterId
        if (this.myChart !== undefined) {
          this.myChart.clear()
        }
        this.$refs.measureSelect.getDataFromUp(this.conditionInfo, this.sampleSize)
        this.$refs.measureDetailed.getDetailMessage(row.dataType, row.specification, this.mark, this.country, this.producer, this.conditionInfo, this.selectNum)
      }
    }
  }
}
</script>

<style scoped>
.el-divider--horizontal {
  font-weight: 100;
  display: block;
  height: 1px;
  width: 100%;
  margin: 10px 0;
}
/*去除顶部标头的选择框*/
.el-table >>> .DisabledSelection .cell .el-checkbox__inner {
  display: none;
  position: relative;
}

/*修改el-table中排序小三角样式*/
::v-deep .el-table .caret-wrapper {
  height: 45px;
}
::v-deep .el-table .sort-caret {
  border: 7px solid transparent;
}
::v-deep .el-table .sort-caret.ascending {
  border-bottom-color: #c0c4cc;
  top: 5px;
}
::v-deep .el-table .sort-caret.descending {
  border-top-color: #c0c4cc;
  bottom: 7px;
}
::v-deep .descending .sort-caret.descending {
  border-top-color: #4e9efd;
}
::v-deep .ascending .sort-caret.ascending {
  border-bottom-color: #4e9efd;
}
</style>
